/**
 * Created by Administrator on 2017/2/11.
 */
import { Component,OnInit } from '@angular/core';
import { Router, ActivatedRoute, Params } from '@angular/router';
import { CollectService } from './collect.serve'


@Component({
    selector: 'my-collect',
    templateUrl: 'collect.html',
    providers:[ CollectService ]
})
export class CollectComponent implements OnInit{
       constructor(
         private route: ActivatedRoute,
         private router: Router,
         private collectService:CollectService
       ){}
       private colltid='';
         private collectinfro='';
         private matiral='';
         private fac='';
         private collname='';
         private cont='';
        //从服务取得数据并赋值
       ngOnInit(){
         this.route.params
           .subscribe((params:Params)=>{this.colltid= params['id'];
           });
         let newcolltid =this.colltid;
         this.collectService.collectde(newcolltid)
           .subscribe(
             res=>{ this.collectinfro=res['data'];
             this.matiral=res['cailiao'];
             this.fac=res['gongchang'];
             this.collname=res['collect_name'];
             this.cont=res['content'];
             console.log(this.collectinfro)
             }
           )
       }
       //删除编辑的出现
  private delet=false;
  delelt1(){
    this.delet=true
  }
  delelt2(){
    this.delet=false
  }
   //分享的出现
  private share=true;
  share1(){
    this.share= !this.share
  }

}
